package com.woniu.micropropertyserver.mapper;

import com.github.pagehelper.PageInfo;


import com.woniu.microcommonsserver.entity.PropertyIcCheck;
import com.woniu.micropropertyserver.util.PageRest;
import org.apache.ibatis.annotations.*;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * @author ：zhengbin
 * @date ：Created in 2021/1/28 0028
 * @description：
 * @modified By：
 * @version: $
 */
@Mapper
public interface PropertyIcMapper {

    List<PropertyIcCheck> findAll();

    List<PropertyIcCheck> findByParams(@Param("r") PageRest pageRest, @Param("p") PropertyIcCheck propertyIcCheck);
    int delInfo(Long[] ids);

    int updateDate(@Param("ids") Long[] ids,@Param("start")  Date authorizeStartDate,@Param("end") Date authorizeEndDate, @Param("now") Date now);

    int updateAuth(@Param("p") PropertyIcCheck propertyIcCheck);
    @Options(
            useGeneratedKeys = true,
            keyProperty = "p.id"
    )
    @Insert("insert into property_ic_check(IC_num,authorize_status,authorize_start_date,authorize_end_date,fk_emp_id,fk_building_id,item)values(#{p.icNum},#{p.authorizeStatus},#{p.authorizeStartDate},#{p.authorizeEndDate},#{p.fkEmpId},#{p.fkBuildingId},#{p.item})")
    int saveAuth(@Param("p") PropertyIcCheck propertyIcCheck);

    @ResultType(PropertyIcCheck.class)
    @Select("select id ,IC_num icNum, authorize_status authorizeStatus, authorize_start_date authorizeStartDate, authorize_end_date authorizeEndDate, item,fk_emp_id fkEmpId,fk_building_id  fkBuildingId from property_ic_check where id= #{id}")
    PropertyIcCheck findById(Long id);


}
